const User=require('../models/User')
/**
 * 注册
 * @param {string} username 
 * @param {string} password 
 * @returns User
 */
async function register(username,password){
  const newUser=await User.create({username,password});
  return newUser
}
/**
 * 登录
 * @param {String}} username 
 * @param {String} password 
 * @returns boolean
 */
async function login(username,password){
  const result=await User.findOne({username,password})
  if(result!=null){
    return true
  }
  return false
}
module.exports={register,login}